import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';

class AppBarDemo extends StatelessWidget {
  const AppBarDemo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var localization = GalleryLocalizations.of(context);
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
          icon: const Icon(Icons.menu),
          onPressed: () {},
        ),
        title: Text(localization!.demoAppBarTitle),
        actions: [
          IconButton(
            onPressed: () {},
            icon: const Icon(Icons.favorite),
            tooltip: localization.starterAppTooltipFavorite,
          ),
          IconButton(
            onPressed: () {},
            icon: const Icon(Icons.search),
            tooltip: localization.starterAppTooltipSearch,
          ),
          PopupMenuButton<Text>(itemBuilder: (context) {
            return [
              PopupMenuItem(child: Text(localization.demoNavigationRailFirst)),
              PopupMenuItem(child: Text(localization.demoNavigationRailSecond)),
              PopupMenuItem(child: Text(localization.demoNavigationRailThird)),
            ];
          }),
        ],
      ),
      body: Center(
        child: Text(localization.cupertinoTabBarHomeTab),
      ),
    );
  }
}
